﻿using System;
using System.ComponentModel;
using INTEX.DataBase;
using INTEX.DataBase.Tools;
using System;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace WPFExcelReport
{
    /// <summary>
    /// Interaction logic for EditEventWindow.xaml
    /// </summary>
    public partial class WSINFOR : UserControl
    { 
      
        CollectionViewSource vwWASTAMM
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwWASTAMM");
            }
        }
        DataRow dwWASTAMM
        {
            get
            {
                if (vwWASTAMM.View == null)
                    return null;
                if ((DataRowView)vwWASTAMM.View.CurrentItem == null)
                    return null;
                return ((DataRowView)vwWASTAMM.View.CurrentItem).Row;
            }
        }

        ApplicationBase app
        {
            get
            {
                return ApplicationBase.Instance;
            }
        }
        public INTEXDBC INTEXDBC
        {
            get
            {
                return app.INTEXDBC;
            }
        }
        public INTEXBL INTEXBL
        {
            get
            {
                return app.INTEXBL;
            }
        }
        bool IsLoaded = false;
        SETINTEXDB SetMaster
        {
            get
            {
                return MainViewModel.SetMaster;
            }
        }
        SETINTEXDB SetEnv
        {
            get
            {
                return MainViewModel.SetEnv;
            }
        }
        SETINTEXDB SetDetail
        {
            get
            {
                return MainViewModel.SetDetail;
            }
        }
        MainViewModel MainViewModel;
        public WSINFOR()
        {
       
            InitializeComponent();
            this.Loaded += Windows_Loaded;
        }

        void Windows_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            IsLoaded = true;
            MainViewModel = this.DataContext as MainViewModel;
            if (vwWASTAMM.View != null)
                vwWASTAMM.View.MoveCurrentToFirst();
        } 
    }
}
